<?php
$name="";
$conn = mysql_connect('localhost', 'root', 'vertrigo');
mysql_select_db('tdc', $conn);
?>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	</head>
	<body>
		Tim kiem
		<form action="find_Staff.php" method="POST">
			<table>
				<tr>
					<td>Name:</td><td><input type="text" size="25" name="txtname"/></td>
				</tr>
				<tr>
					<td></td>
					<td><input type="submit" value="Find" name="ok"</td>
				</tr>
					
			</table>
		</form>
	</body>
</html>


<?php
if(isset($_POST['ok']))
{
	if($_POST['txtname']==NULL)
	{
		echo"Vui long nhap tim kiem nhan vien";
	}
	else
	{
		$name=$_POST['txtname'];
	}
	if($name)
	{
		$sql="select * from staff where staff_name='$name';";
		$query=mysql_query($sql);
		$count=mysql_num_rows($query);
		
		
		if($count!=NULL)
		{
			$stt=1;
			echo"<table boder='1'>";
			echo"<tr>
            <td>STT</td>
            <td>NAME</td>
			<td>Dell</td>
			</tr>";
			while($data=mysql_fetch_assoc($query))
			{
				echo"<tr>";
				echo"<td>$stt</td>";
				echo"<td>$data[staff_name]</td>";
				echo"<td><a href='dell_Staff.php?staff_id=$data[staff_id]'>X</a></td>";
				echo"<tr>";
			}
			echo"</table>";
		}
	if($count==NULL)
		{
		echo"Eo tim thay";
		}
	}
}
?>
